// 模块：账号
import axios from 'axios'

const modelUrl = '/system'

// 账号
export interface AccountReq {
  userName: string
  enable: number
  userAccount: string
  phoneNumber: string
  userPassword: string
  isAdmin: number
  userId?: number
}

export interface AccountRes {
  userId: number
  enable: number
  phoneNumber: string
  userName: string
  userAccount: string
}

export interface AccountListSearch {
  enable: string
  userName: string
  phoneNumber: string
  userAccount?: string
}

export function editAccount(data: AccountReq) {
  return axios.post<AccountRes>(modelUrl + '/authUserAdit', data)
}

export function getAccountAllList(data?: AccountListSearch) {
  return axios.post<{
    currentPage?: number
    pageSize?: number
    totalPage?: number
    totalCount?: number
    list: AccountRes[]
  }>(modelUrl + '/authUserList', data)
}

export function getAccountPageList(data: AccountListSearch) {
  return axios.post<{
    currentPage?: number
    pageSize?: number
    totalPage?: number
    totalCount?: number
    list: AccountRes[]
  }>(modelUrl + '/authUserPage', data)
}
